package com.lanhe.order.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lanhe.order.domain.LhOrdersDuoyouLog;
import com.lanhe.order.mapper.LhOrdersDuoyouLogMapper;
import com.lanhe.order.service.ILhOrdersDuoyouLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * (LhOrdersDuoyouLog)表服务实现类
 *
 * @author zhanggl
 * @since 2023-12-11 14:44:13
 */
@Service
public class LhOrdersDuoyouLogServiceImpl extends ServiceImpl<LhOrdersDuoyouLogMapper, LhOrdersDuoyouLog> implements ILhOrdersDuoyouLogService {

	@Autowired
	private LhOrdersDuoyouLogMapper ordersDuoyouLogMapper;

	/**
	 * 增加多游订单日志
	 *
	 * @param ordersDuoyouLog 实体
	 * @return int 结果
	 * @author zhanggl
	 * @date 2023/12/11
	 */
	@Override
	public Long insertOrdersDuoyouLog(LhOrdersDuoyouLog ordersDuoyouLog) {

		ordersDuoyouLog.setCreateTime(new Date());
		ordersDuoyouLogMapper.insert(ordersDuoyouLog);
		return ordersDuoyouLog.getOrdersDuoyouLogId();
	}

	/**
	 * 更新多游订单日志
	 *
	 * @param ordersDuoyouLog 实体
	 * @return int 结果
	 * @author zhanggl
	 * @date 2023/12/11
	 */
	@Override
	public int updateOrdersDuoyouLog(LhOrdersDuoyouLog ordersDuoyouLog) {

		LambdaUpdateWrapper<LhOrdersDuoyouLog> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
		lambdaUpdateWrapper.eq(LhOrdersDuoyouLog::getOrdersDuoyouLogId,ordersDuoyouLog.getOrdersDuoyouLogId());
		LhOrdersDuoyouLog lhOrdersDuoyouLog = new LhOrdersDuoyouLog();
		lhOrdersDuoyouLog.setStatus(ordersDuoyouLog.getStatus());
		lhOrdersDuoyouLog.setReason(ordersDuoyouLog.getReason());
		return ordersDuoyouLogMapper.update(lhOrdersDuoyouLog,lambdaUpdateWrapper);
	}
}

